package com.mark.article.controller.v1;

import com.mark.article.apis.ArticleInfoControllerApi;
import com.mark.article.service.AppArticleInfoService;
import com.mark.model.article.dtos.ArticleInfoDto;
import com.mark.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description :  java类作用描述
 * @Author :  Markburt
 * @CreateDate :  2020/2/27$ 下午 07:03$
 * @UpdateUser :  Markburt
 * @UpdateDate :  2020/2/27$ 下午 07:03$
 * @UpdateRemark :  Project Build
 * @Version :  1.0
 */
@RestController
@RequestMapping("/api/v1/article")
public class ArticleInfoController  implements ArticleInfoControllerApi {


    @Autowired
    private AppArticleInfoService appArticleInfoService;

    /**
     * 加载项目行为
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/load_article_info")
    public ResponseResult loadArticleInfo(@RequestBody ArticleInfoDto dto) {
        return  appArticleInfoService.getArticleInfo(dto.getArticleId());
    }

    /**
     *  加载文章详情的初始化配置信息，比如关注，收藏，点赞，不喜欢
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/load_article_behavior")
    public ResponseResult loadArticleBehavior(ArticleInfoDto dto) {
        return appArticleInfoService.loadArticleBehavior(dto);
    }
}
